<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
    [
        '<div contenteditable="true">',
            '<a href="http://www.facebook.com/">',
                '<span>',
                    '<object style="border-color: initial;',
                    'display: block; position: absolute;',
                    'background-image: initial;',
                    'background-repeat: initial;',
                    'background-attachment: initial;',
                    '-webkit-background-clip: initial;',
                    '-webkit-background-origin: initial;">',
                    '</object>',
                '</span>',
             '</a>',
         '</div>'
    ],
    selection=> {
        const document = selection.document;
        const obj = document.querySelector('object');
        selection.collapse(obj, 0);
        document.execCommand("InsertParagraph");
    },
    [
        '<div contenteditable="true">',
            '<div><br></div>',
            '<span>',
                '<a href="http://www.facebook.com/">|',
                    '<object style="border-color: initial;',
                    'display: block; position: absolute;',
                    'background-image: initial;',
                    'background-repeat: initial;',
                    'background-attachment: initial;',
                    '-webkit-background-clip: initial;',
                    '-webkit-background-origin: initial;">',
                    '</object>',
                 '</a>',
            '</span>',
         '</div>'
   ],
    'InsertParagraph should not crash on an object element'
);
</script>